package com.yunang.officialweb.service.impl;

import com.yunang.officialweb.entity.AboutUs;
import com.yunang.officialweb.entity.TotalDesc;
import com.yunang.officialweb.mapper.AUMapper;
import com.yunang.officialweb.mapper.HomeMapper;
import com.yunang.officialweb.service.AUService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author duan
 * @date 2022/12/1 13:35
 */
@Service
public class AUServiceImpl implements AUService {
    @Resource
    private HomeMapper homeMapper;

    @Autowired
    private AUMapper auMapper;

    @Override
    public TotalDesc selectViewDesc() {
        return homeMapper.getTotalDesc(8);
    }

    @Override
    public Boolean updateViewDesc(TotalDesc totalDesc) {
        totalDesc.setId(8);
        return homeMapper.updateTotalDesc(totalDesc);
    }

    @Override
    public Map<String, Object> getPageOfComInt() {
        Map<String, String> vieDesc = new HashMap<>();
        Map<String, Object> resultMap = new HashMap<>();

        vieDesc.put("viewDescTitle", selectViewDesc().getChineseName());
        vieDesc.put("viewDescText", selectViewDesc().getText());

        resultMap.put("viewDesc", vieDesc);
        resultMap.put("companyIntroduce", auMapper.getAll());

        return resultMap;
    }

    @Override
    public Boolean updateAU(AboutUs aboutUs) {
        return auMapper.updateAU(aboutUs);
    }


}
